<template>
	<view class="content">
		<view class="hei20"></view>
		<view class="wid90 mar bacFFF borRad20 mar-top10">
			<view class="wid90 mar dis disAl disJuB" style="height: 128rpx;">
				<view class="dis disAl">
					<view style="width: 50rpx;">
						<image src="../../static/imgs/icon/fahuo.png" style="width: 40rpx;height: 36rpx;"></image>
					</view>
					<view v-if="list.status === 1" class="mar-left10 foSi30">未发货</view>
					<view v-if="list.status === 2" class="mar-left10">
						<view class="foSi30" style="color: #3978F9;">已发货，正在等待快递取件</view>
						<view class="foSi25 mar-top15" style="color: #969696;">{{ list.createtime }}</view>
					</view>
					<view v-if="list.status === 3" class="mar-left10">
						<view class="foSi30">已收货</view>
						<view class="foSi25 mar-top15" style="color: #969696;">{{ list.createtime }}</view>
					</view>
				</view>
				<i class="fa fa-angle-right" />
			</view>
			<view class="wid100" style="border-bottom: 2rpx dashed #E1DFDF;"></view>
			<view class="wid90 mar dis disAl disJuB" style="height: 128rpx;">
				<view class="dis disAl">
					<view style="width: 50rpx;">
						<image src="../../static/imgs/icon/weizhi2.png" style="width: 34rpx;height: 44rpx;"></image>
					</view>
					<view class="mar-left10">
						<view class="foSi30">{{ list.province }} {{ list.city }} {{ list.area }} {{ list.address }}
						</view>
						<view class="foSi25 mar-top15" style="color: #969696;">{{ list.tel }} {{ list.username }}</view>
					</view>
				</view>
				<i class="fa fa-angle-right" />
			</view>
		</view>
		<view class="wid90 mar bacFFF borRad20 mar-top30" style="padding: 15rpx;">
			<view class="wid95 mar dis disAl disJuB">
				<view class="wid20">
					<image :src="url+list.cover_img" style="width: 154rpx;height: 154rpx;"></image>
				</view>
				<view class="wid80">
					<view class="wid100 dis disAl disJuB">
						<view class="fowebl foSi35">{{ list.title }}</view>
						<view class="foSi25" style="color: #737373;">x {{ list.num }}</view>
					</view>
					<view class="hei20"></view>
					<view class="wid100 foSi30 mar-top40" style="text-align: right;color: #E20A21;">{{ list.price }}积分
					</view>
				</view>
			</view>
		</view>
		<view class="wid90 mar borRad20 bacFFF mar-top30" style="padding: 20rpx 0;">
			<view class="wid95 mar foSi24">
				<view class="hei80 dis disAl disJuB">
					<view style="color: #737373;">订单编号</view>
					<view class="dis disAl">
						<view>{{ list.order_id }}</view>
						<view class="dis disAl disJuC foSi22 mar-left20" @click.stop="copy(list.order_id)"
							style="width: 56rpx;height: 30rpx;color: #737373;border: 1rpx solid #737373;">复制</view>
					</view>
				</view>
				<view class="hei80 dis disAl disJuB">
					<view style="color: #737373;">兑换时间</view>
					<view>{{ list.createtime }}</view>
				</view>
				<view class="hei80 dis disAl disJuB">
					<view style="color: #737373;">运费</view>
					<view>¥0.00</view>
				</view>
				<view class="hei80 dis disAl disJuB">
					<view style="color: #737373;">优惠券</view>
					<view>无</view>
				</view>
				<view class="hei80 dis disAl disJuB">
					<view style="color: #737373;">支付方式</view>
					<view>积分兑换</view>
				</view>
				<view class="hei80 dis disAl disJuB">
					<view style="color: #737373;">消耗积分</view>
					<view style="color: #E20A21;">{{ list.price }}积分</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		Goods
	} from '../../model/integralgoods-model';
	var Goods2 = new Goods()
	import { Config } from '../../utils/config.js';
	export default {
		data() {
			return {
				url: Config.restUrl,
				id: null,
				list: null
			}
		},
		onLoad(option) {
			this.id = option.id
			this.getList()
		},
		onShow() {},
		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function() {
			this.getList()
		},
		methods: {
			copy(value) {
				uni.setClipboardData({
					data: value, //要被复制的内容
					success: () => { //复制成功的回调函数
						uni.showToast({ //提示
							title: '复制成功'
						})
					}
				});
			},
			getList() {
				var that = this
				let params = {
					id: that.id
				}
				Goods2.orderDetails((data) => {
					console.log(data)
					if (data.code === 0) {
						that.list = data.data
					} else {
						uni.showToast({
							title: data.msg,
							icon: 'none',
							duration: 2000
						})
					}
					uni.hideNavigationBarLoading(); //完成停止加载
					uni.stopPullDownRefresh();
				}, params)
			}
		}
	}
</script>

<style>
	.content {
		height: 100vh;
	}

	.xia {
		height: 1rpx;
		background: #D2D2D2;
	}
</style>